package com.wangsd.web.interceptor;

import com.wangsd.web.utils.Message;
import com.wangsd.web.utils.Validation;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AuthenticationInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
        if (request == null) {
            Message.append("[request]参数为null");
            return false;
        }
        if (Validation.permissionValidate(request)) return true;
        Message.append("非法请求：" + request.getRequestURI());
        return false;
    }
}
